package com.leyou.order.config;

import com.leyou.common.utils.IdWorker;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Data
@Configuration
@ConfigurationProperties(prefix = "ly.worker")
public class IdWorkerConfig {

    private long workerId;
    private long dataCenterId;
    
    @Bean
    public IdWorker idWorker(){
        return new IdWorker(workerId, dataCenterId);
    }
}